package org.jeecg.modules.demo.mthet.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import org.jeecg.modules.demo.mthet.entity.MtHet;
import org.jeecg.modules.demo.mthet.mapper.MtHetMapper;
import org.jeecg.modules.demo.mthet.service.IMtHetService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * @Description: mt_het
 * @Author: jeecg-boot
 * @Date:   2025-04-30
 * @Version: V1.0
 */
@DS("multi-datasource1")
@Service
public class MtHetServiceImpl extends ServiceImpl<MtHetMapper, MtHet> implements IMtHetService {

    @Override
    public String getYaoYHetbh(String trademode, String way) {
        String ret = "";
        if (trademode.equals("1")) {
            trademode = "G";
        }
        else if (trademode.equals("2")) {
            trademode = "Z";
        }
        else if (trademode.equals("3")) {
            trademode = "P";
        }
        else if (trademode.equals("4")) {
            trademode = "T";
        }
        String sName = trademode + "H" + way + "0";
        ret = this.getBaodbh(sName);// this.getHetbh(this.getBaodbh(sName));
        return ret;
    }

    /**
     * 获取报单编号
     *
     * @param sName
     * @return
     */
    public String getBaodbh(String sName) {
        String ret = "";
        ret = this.baseMapper.getBaodbh(sName);
        return ret;

    }

    @Override
    public String genrateHetId(String text) {
        return baseMapper.genrateHetId(text);
    }
}
